#include "codeitem.h"
#include "expara.h"

CodeItem::CodeItem(QObject *parent) : QObject(parent)
{
    db.connectDB();
}

void CodeItem::DealText(QString const text)
{
    QStringList list;
    QString temp = text;
    for(int i =0; i< temp.count() || temp == ""; i++)
    {
        if(temp[i] == ' ')
        {
           QString tmp = temp.left(i + 2);
           list << tmp;
           temp = temp.right(temp.length() - tmp.length());
        }
        else if(temp[i] == ',')
        {
            QString tmp =temp.left(i+1);
            list << tmp;
            temp = temp.right(temp.length() - tmp.length());
            tmp = temp.left(2);
            list << tmp;
            temp = temp.right(temp.length() - tmp.length());
        }
        else if(temp[i] == ';')
        {

        }
    }
}

QStringList CodeItem::textlist() const
{
    return textList;
}

void CodeItem::setTextlist(const QStringList &list)
{
    textList = list;
}
